package com.bawei.mall.product.controller;

import com.bawei.common.core.domain.R;
import com.bawei.common.security.annotation.RequiresPermissions;
import com.bawei.mall.product.domain.MallProductHotWord;
import com.bawei.mall.product.service.IMallProductHotWordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName MallProductHotWordController
 * @Description 描述
 * @Author ZiZheng.Li
 * @Date 2024/6/26 9:19
 */
@RestController
@RequestMapping("/hotWord")
@Api(tags = "商品热词")
public class MallProductHotWordController {
    @Autowired
    private IMallProductHotWordService mallProductHotWordService;

    @GetMapping("/list")
    @ApiOperation("查询商品热词列表")
    public R<List<MallProductHotWord>> list()
    {
        List<MallProductHotWord> list = mallProductHotWordService.selectMallProductHotWordList();
        return R.ok(list);
    }


    @RequiresPermissions("product:hotWord:add")
    @PostMapping("/insert")
    public R add(@RequestBody MallProductHotWord mallProductHotWord)
    {
        mallProductHotWordService.insertMallProductHotWord(mallProductHotWord);
        return R.ok();
    }
}
